//
//  JFirstView.m
//  HeadIndustry
//
//  Created by jun on 2017/8/30.
//  Copyright © 2017年 jun. All rights reserved.
//

#import "JFirstView.h"

@implementation JFirstView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
     
        self.opaque = NO;
        self.backgroundColor = [UIColor whiteColor];
//        [self setUpView];
    }
    return self;
}

- (void)setUpView:(NSArray *)imgArr {
    
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        
        for (int i = 0; i<imgArr.count; i++) {
            
            CALayer *imgLayer = [CALayer layer];
            imgLayer.frame = CGRectMake(10, 25 + i * _imgHeight, kWindowW - 20, _imgHeight);
            UIImage *imgData = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imgArr[i]]]];
            imgLayer.contents = (__bridge id _Nullable)(imgData.CGImage);
            
            dispatch_async(dispatch_get_main_queue(), ^{
                [self.layer addSublayer:imgLayer];
            });
            
        }
    });
    
}

- (void)setImgDataArr:(NSArray *)imgDataArr
{
    _imgDataArr = imgDataArr;
    [self setUpView:imgDataArr];
}

@end
